// 用户数据模型的模块

// 加载模块
const mongoose = require('mongoose')

// 创建Schema对象
const usersSchema = mongoose.Schema({
    user: {
        type: String,
        required: true
    },
    pass: {
        type: String,
        required: true
    },
    email: {
        type: String,
        required: true
    },
    nickname: {
        type: String,
        required: true
    },
    sex: {
        type: String,
        default: '妖'
    },
    age: {
        type: String,
        default: '18'
    }
})

// 把 schema对象编译成一个 Model 数据模型
const usersModel = mongoose.model('users',usersSchema)

// 对外暴露数据模型
module.exports = usersModel
